<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>无标题文档</title>
    <link href="__STATIC__/Admin/css/base.css" rel="stylesheet" type="text/css" />
    <link href="__STATIC__/Admin/css/right.css" rel="stylesheet" type="text/css">
    <link href="__STATIC__/Admin/css/select.css" rel="stylesheet"  type="text/css">
    <script language="JavaScript" src="__STATIC__/js/jquery-2.1.1.min.js"></script>
    <script language="JavaScript" src="__STATIC__/js/select-ui.min.js"></script>
    <script type=text/javascript src="__STATIC__/ueditor/ueditor.config.js"></script>
    <script type=text/javascript src="__STATIC__/ueditor/ueditor.all.js"></script>
    <link rel="stylesheet" href="__STATIC__/ueditor/themes/default/css/ueditor.css"/>
    <script>
        $(document).ready(function(){
            $(function(){
            });
            $(".select1").uedSelect({
                width : 345
            });
        });
    </script>
</head>

<body>
<div class="place"> <span>位置：</span>
    <ul class="placeul">
        <li><a href="{:url('Index/center')}">首页</a></li>
        <li>
            奖励设置
        </li>
    </ul>
</div>
<div class="formbody">
    <form name="fadd" method="post" id="add" action="{:url('Jiangli/addInfo')}" enctype="multipart/form-data">
        <ul class="forminfo">
		<li>
                
                <input class="type_select" type="radio" checked="checked" name="type" value="1" />文字
				<input class="type_select" type="radio" name="type" value="2" style="margin-left:30px;" />图片
            </li>
            <li id="words">
                <label>内容</label>
                <textarea name="ncontent" class="textinput" style="width:700px; height:320px;">
            </textarea>
                <i></i>
            </li>
			<li id="imgs" style="margin-top: 40px;display:none;">
                <label>上传图片</label>
                <input type="file" name="img" id="qr" value="">
                <i id="f"></i>
            </li>
            <li>
                <label>&nbsp;</label>
                <input type="button" id="true" class="btn" value="保存" />
            </li>
        </ul>
    </form>
</div>
<div class="rightinfo">
    <table class="tablelist">
        <thead>
        <tr>
            <th>奖励语</th>
            <th>是否置顶</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="list" id="vo"}
            <tr height="45" align="center">
                <td>
				{if($vo['type']==1)}
				{$vo['content']}
				{else}
				<img onclick="showBigImg('{$httpurl.$vo['content']}')" src="{$httpurl.$vo['content']}" width="45px" height="45px">
				{/if}
				</td>
                <td style="color: #00a0e9;">
                    {if $vo['is_select'] == 1}
                    置顶项
                    {else}
                    <a href="{:url('Jiangli/setTop',['id'=>$vo['id']])}">置顶</a>
                    {/if}
                </td>
                <td><a style="color: #00a0e9;" href="{:url('Jiangli/delInfo',['id'=>$vo['id']])}" onclick="del();">删除</a></td>
            </tr>
        {/volist}
        </tbody>
    </table>
</div>

<div id="big_img" class="dialog fill-all flex h-center v-center" style="visibility:hidden;position:fixed;" onclick="closeDialogs()">

<img id="show_img" style="max-height:80%;max-width:80%;"/>

</div>

<script type="text/javascript">
    UE.getEditor('myEditor', {
        theme:"default", //皮肤
        lang:"zh-cn", //语言
        initialFrameWidth:700,  //初始化编辑器宽度,默认800
        initialFrameHeight:320
    });
	$(function(){
	$(".type_select").change(function(){
	var v = $("input[name='type']:checked").val();
	if(v==1){
	$("#words").css("display","block");
	$("#imgs").css("display","none");
	}else{
	
	$("#imgs").css("display","block");
	$("#words").css("display","none");
	}
	});
	$("#true").click(function () {
	var v = $("input[name='type']:checked").val();
	if(v==2){
	if(checkqr()) {
                $("#add").submit();
            }
	}else{
	$("#add").submit();
	}
            
        });
	
	});
	//检查二维码图片
        function checkqr()
        {
            if(!$("#qr").val()) {
                $("#f").html('<font color="red">不能为空</font>');
                return false;
            }else{
                $("#f").html('');
                return true;
            }
        }
    function del(){ if(confirm("确定要删除吗？")) {   return true;  }  else  {  return false;  } }
	
	function showBigImg(paths){
	$("#big_img").css("visibility","visible");
	$("#show_img").attr("src",paths);
	}
	
	function closeDialogs(){
	$("#big_img").css("visibility","hidden");
	}
</script>
</body>
</html>
